﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Task
{
    class Program
    {
        static void Main(string[] args)
        {
            Game mv = new Game();
            mv.name = "纪念碑谷";
            mv.Category = "冒险解谜类手机游戏";
            mv.price = 30;
            mv.stock = 100;
            mv.addTime = DateTime.Now;//添加日期为今天
            Game aci = new Game();
            aci.name = "刺客信条";
            aci.Category = "角色扮演手机类游戏";
            aci.price = 28;
            aci.stock = 100;
            aci.addTime = DateTime.Now;//添加日期为今天
            Game wmw = new Game();
            wmw.name = "鳄鱼洗澡";
            wmw.Category = "休闲益智类手机游戏";
            wmw.price = 6;
            wmw.stock = 100;
            wmw.addTime = DateTime.Now;//添加日期为今天
            //定义游戏数组，将3个游戏对象存储在数组中
            Game[] gameList = new Game[3];
            gameList[0] = mv;
            gameList[1] = aci;
            gameList[2] = wmw;
            //遍历数组，打印游戏列表
            Console.WriteLine("序号\t游戏名称\t\t游戏类型\t\t游戏价格\t库存数量");
            for (int i = 0; i < gameList.Length; i++)
            {
                Console.WriteLine(i + "\t《" + gameList[i].name + "》\t\t"
                    + gameList[i].Category + "\t"
                    + gameList[i].price + "\t\t"
                    + gameList[i].stock);
            }
            Console.WriteLine("==========游戏入库==========");
            //调用Store()方法实现游戏入库10份
            gameList[0].Store(10);
            gameList[1].Store(10);
            gameList[2].Store(10);
            //调用Sale（）方法实现游戏销售2份
            gameList[0].Sale(2);
            gameList[1].Sale(2);
            gameList[2].Sale(2);
        }
    }
}
